package com.walter.schedule;

import cn.hutool.core.date.DateUtil;
import com.walter.service.SystemService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author ：ch
 * @date ：Created in 2021/5/25
 * @description：
 * @modified By：
 * @version: 1.0
 */
@Component
@Slf4j
public class AutoTask {
    @Autowired
    private SystemService systemService;

    @Scheduled(cron = "0 0 12 ? * MON")  // 0 0 12 ? * MON  每个星期一中午12点
    public void backupDB(){
        log.info("A timed task[backupDB] is handling.Time : {}", DateUtil.now());
        systemService.backupDB();
    }
}
